package com.tobeface.wechat.message.payload;

import com.tobeface.wechat.message.WeChatMessageBuilder;
import com.tobeface.wechat.message.WeChatMessagePayloads;
import com.tobeface.wechat.message.WeChatMessageTypes;

import java.util.Map;

/**
 * @author loudyn
 */
public class VoiceMessagePayloadBuilder extends AbstractMessagePayloadBuilder {

    private String mediaId;
    private String mediaFormat;

    /**
     * @param parent
     */
    public VoiceMessagePayloadBuilder(WeChatMessageBuilder parent) {
        super(parent);
    }

    /**
     * @param mediaFormat
     * @return
     */
    public VoiceMessagePayloadBuilder mediaFormat(String mediaFormat) {
        this.mediaFormat = mediaFormat;
        return this;
    }

    /**
     * @param mediaId
     * @return
     */
    public VoiceMessagePayloadBuilder mediaId(String mediaId) {
        this.mediaId = mediaId;
        return this;
    }

    @Override
    protected void configPayloads(Map<String, Object> payloads) {
        payloads.put(WeChatMessagePayloads.MSGTYPE_PAYLOAD, WeChatMessageTypes.VOICE);
        payloads.put(WeChatMessagePayloads.MEDIAFORMAT_PAYLOAD, mediaFormat);
        payloads.put(WeChatMessagePayloads.MEDIAID_PAYLOAD, mediaId);
    }
}
